package com.westcom.healthmate.common.network.http;


import java.io.IOException;

import com.westcom.healthmate.common.utils.CommonUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;

public class SyncPost {
	private DefaultHttpClient mHttpClient;
	
    public static SyncPost create() {
        return new SyncPost();
    }
    
    public SyncPost() {
	    mHttpClient = new DefaultHttpClient();
    }
    public HttpResponse post(String url,org.apache.http.Header[] h,HttpEntity entity) throws ClientProtocolException, IOException
    {
    	HttpPost httppost = new HttpPost(url);

    	if(null != h)
    	{
    		httppost.setHeaders(h);
    	}
    	if(null != entity)
    	{
    		httppost.setEntity(entity);
    	}
		CommonUtils.disableSSLVerification(mHttpClient);
        HttpResponse httpResponse = mHttpClient.execute(httppost);
        return httpResponse;
    }
}